import JSEncrypt from 'jsencrypt.min.js'

// 密钥对生成 http://web.chacuo.net/netrsakeypair

const publicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwrVwlpELwVCIYIJ2rUkuyWu+UGnrZfsUIV4F1ZBFxU4zQuS64sOG93CpCq81gm2yLFTaXdXRRwFjk8sCGzAw75c6P205Gubhc74+hvB5j9BUkSBQbYhJpW+zpvXg1qaGV34+7TsXFbdSMynAVq85Kqw29m9EnefQZmDK2YLKYxqrTYBCZRHUPjGjriqWU659Yd2Ag8f4u9SsHEaLTNE/c/cBNMfOKHh8RXvwyUya7964J5P5ds9U5agwVP1n2BU2FLlpCgzgHj1NW/FmTRwPOIYoyC60b7RNacP3rtr9Ce+5UDQxyXpZ3ip3PSCndD/Ef2BW56wQr4xdXR4YGqrYiQIDAQAB'

// const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY\n' +
//   '7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN\n' +
//   'PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA\n' +
//   'kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow\n' +
//   'cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99Ecv\n' +
//   'DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh\n' +
//   'YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3\n' +
//   'UP8iWi1Qw0Y='

// 加密
export function encrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(publicKey) // 设置公钥
  return encryptor.encrypt(txt) // 对数据进行加密
}

// 解密
// export function decrypt(txt) {
//   const encryptor = new JSEncrypt()
//   encryptor.setPrivateKey(privateKey) // 设置私钥
//   return encryptor.decrypt(txt) // 对数据进行解密
// }